package ar.com.jwa.services;

import java.util.Collection;

import ar.com.jwa.domain.Game;
import ar.com.jwa.domain.User;

public class SystemFacade {
	
	
	private UserLocalService userLocalService;
	
	private GameLocalService gameLocalService;

	public SystemFacade() {
		super();
	}

	public void saveUser(User user){
		this.getUserLocalService().saveUser(user);
	}

	/**
	 * @return the userLocalService
	 */
	public UserLocalService getUserLocalService() {
		if (this.userLocalService == null){
			throw new RuntimeException("userLocalService is not setted up");
		}
		return userLocalService;
	}

	/**
	 * @param userLocalService the userLocalService to set
	 */
	public void setUserLocalService(UserLocalService userLocalService) {
		this.userLocalService = userLocalService;
	}

	public boolean login(User user) {
		if (this.userLocalService.login(user))
			return true;
		return false;
	}

	/**
	 * Este metodo devuelve si hay algun evento si confirmar. En esta version solo podra haber un evento sin confirmar.
	 * @param user
	 * @return
	 */
	public Boolean hasToConfirmSomething(User user) {
		return this.getGameLocalService().hasToConfirmSomething(user);
	}
	
	public Collection<Game> getGamesToConfirm(){
		return this.getGameLocalService().getGamesToConfirm();
	}

	/**
	 * @return the gameLocalService
	 */
	public GameLocalService getGameLocalService() {
		return gameLocalService;
	}

	/**
	 * @param gameLocalService the gameLocalService to set
	 */
	public void setGameLocalService(GameLocalService gameLocalService) {
		this.gameLocalService = gameLocalService;
	}
}
